from selenium import webdriver
from selenium.webdriver.common.by import By

if __name__ == '__main__':
    driver=webdriver.Chrome()
    driver.get("https://car.d1ev.com/")
    driver.execute_script("while(1==1){loadmore();if(document.getElementById('loaded_all').style.display=='block'){break;}}")
    neaItems=driver.find_elements(By.XPATH,"//*[@id='list_info_series_ul']/li")
    for neaItem in neaItems:
        #品牌
        neaName=neaItem.find_element(By.XPATH,"div[2]/ul[1]/li[1]/a/p").text
        #指导价格
        neaGuidingPrice=neaItem.find_element(By.XPATH,"div[2]/ul[1]/li[2]/span[1]").text
        #补贴后价格
        neaSubsidyPrice=neaItem.find_element(By.XPATH,"div[2]/ul[1]/li[3]/span").text
        #车型
        neaVehicleModel=neaItem.find_element(By.XPATH,"div[2]/ul[1]/li[4]").text
        #续航
        neaEndurance=neaItem.find_element(By.XPATH,"div[2]/ul[2]/li[1]/span").text
        #零百加速
        neaAccelerate=neaItem.find_element(By.XPATH,"div[2]/ul[2]/li[3]/span").text
        #电池容量
        neaBatteryCapacity=neaItem.find_element(By.XPATH,"div[2]/ul[2]/li[5]/span").text
        #自动驾驶
        neaAutonomousDriving=neaItem.find_element(By.XPATH,"div[2]/ul[2]/li[6]/span").text
        print(neaName+" "+neaGuidingPrice+" "+neaSubsidyPrice)